<template>
    <p style="white-space: pre-line;"></p>
    <el-card style="width: 100%">
        <template #header>
            <div class="card-header">
                <div style="font-size: xx-large;">{{ information.title }}</div>
            </div>
        </template>
        <el-main>
            <p>{{ information.description }}</p>
        </el-main>
        <div style="margin: 20px 0"></div>
        <el-footer>
            <el-button type="primary" size="large" plain @click="goToNewQuestionnaire">点击查看</el-button>
            <el-button v-if="ifManagement" type="primary" size="large" plain @click="deleteItem">点击删除</el-button>
            <el-row>
                <el-col :span="4" :offset="15">创建时间:{{ information.created_at }}</el-col>
                <el-col :span="1">----</el-col>
                <el-col :span="4">最新更新时间:{{ information.updated_at }}</el-col>
            </el-row>
        </el-footer>
    </el-card>
</template>

<script>
export default {
    props: {
        information: {
            type: Object,
            required: true
        },
        ifManagement: {
            type: Boolean,
            default: false
        }
    },
    methods: {
        goToNewQuestionnaire() {
            this.$router.push({ name: 'NewQuestionnaire', params: { id: this.information.id } });
        },
        deleteItem() {
            alert("删除功能暂不开放！");
        }
    }
}
</script>
